package bean

var TYPE_DEVICE_COMPANY_ADD = "deviceCompanyAdd"
var TYPE_DEVICE_COMPANY_REMOVE = "deviceCompanyRemove"
var TYPE_DEVICE_STATUS = "deviceStatus"
var TYPE_DEVICE_UPLOAD = "deviceUpload"
var TYPE_DEVICE_DELETE = "deviceDelete"
var TYPE_DEVICE_WARN = "deviceWarn"
var TYPE_DEVICE_REGISTER = "deviceRegister"
var TYPE_SERVER_SEND = "serverSend"
var TYPE_UN_KNOW = "unKnow"

type BaseProtocol struct {
	DeviceCore string `json:"deviceCore"`
	Timestamp  int32  `json:"timestamp"`
}

type IotDeviceStatusUniJsonProtocol struct {
	BaseProtocol
	Status   string `json:"status"`
	ClientIp string `json:"clientIp"`
	ClientId string `json:"clientId"`
	ServerId int32  `json:"serverId"`
}

type IotDeviceLocal struct {
	Mcc  string `json:"mcc"`
	Mnc  string `json:"mnc"`
	Lac  string `json:"lac"`
	Ci   string `json:"ci"`
	Bsic string `json:"bsic"`
}

type IotDeviceSetting struct {
	KeyName string      `json:"keyName"`
	Port    string      `json:"port"`
	Value   interface{} `json:"value"`
}

type IotSensorSetting struct {
	KeyName string      `json:"keyName"`
	Value   interface{} `json:"value"`
	Status  int32         `json:"status"`
}

type IotSensorParam struct {
	KeyName string      `json:"keyName"`
	Value   interface{} `json:"value"`
}

type IotSensorExplain struct {
	KeyName  string      `json:"keyName"`
	Value    interface{} `json:"value"`
	RawValue string      `json:"rawValue"`
	Type     string      `json:"type"`
}

type SensorBean struct {
	Port        string          `json:"port"`
	SensorId    int32             `json:"sensorId"`
	Status      string          `json:"status"`
	SettingList []IotSensorSetting `json:"settingList"`
	ExplainList []IotSensorExplain `json:"explainList"`
	ParamList   []IotSensorParam   `json:"paramList"`
}

type IotDeviceUploadUniJsonProtocol struct {
	BaseProtocol
	Version      string        `json:"version"`
	MsgId        string        `json:"msgId"`
	Error        string        `json:"error"`
	Msg          string        `json:"msg"`
	NeedResponse bool          `json:"needResponse"`
	Lat          float64       `json:"lat"`
	Lng          float64       `json:"lng"`
	Charging     bool          `json:"charging"`
	Direction    string        `json:"direction"`
	Speed        float64       `json:"speed"`
	Local        IotDeviceLocal   `json:"local"`
	Setting      IotDeviceSetting `json:"setting"`
	SensorList   []SensorBean  `json:"sensorList"`
}

type IotDeviceProtocolWarp struct {
	DeviceUpload IotDeviceUploadUniJsonProtocol `json:"deviceUpload"`
	DeviceStatus IotDeviceStatusUniJsonProtocol `json:"deviceStatus"`
	Prior        bool                        `json:"prior"`
}

type SystemHookWarp struct {
	IotDeviceProtocolWarp
	MsgType    string `json:"type"`
	DeviceCore string `json:"deviceCore"`
	Timestamp  int32  `json:"timestamp"`
}
